package huawei.js2025;

import java.util.*;

/**
 * 免单统计
 */
public class Question41 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = Integer.parseInt(scanner.nextLine());
        Map<String, List<String>> timeMap = new HashMap<>();

        // 读取所有的下单时间
        for (int i = 0; i < n; i++) {
            String fullTime = scanner.nextLine();
            // 获取秒级时间 yyyy-MM-dd HH:mm:ss
            String secondTime = fullTime.substring(0, 19);

            // 将订单按秒放入Map
            timeMap.putIfAbsent(secondTime, new ArrayList<>());
            timeMap.get(secondTime).add(fullTime);
        }

        scanner.close();

        int freeCount = 0;

        // 遍历每个秒级时间
        for (Map.Entry<String, List<String>> entry : timeMap.entrySet()) {
            List<String> orders = entry.getValue();
            String earliestOrder = null;

            // 找到该秒内最早的订单
            for (String order : orders) {
                if (earliestOrder == null || order.compareTo(earliestOrder) < 0) {
                    earliestOrder = order;
                }
            }

            // 统计最早订单的数量
            for (String order : orders) {
                if (order.equals(earliestOrder)) {
                    freeCount++;
                }
            }
        }

        // 输出结果
        System.out.println(freeCount);
    }


}
